<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



<html>
<script  type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<body>




账号 <input type="text" id="username">

密码 <input type="text" id="userpwd">

啊啊<input type="text" id="num">

啊啊<input type="text" id="solo">

<button id="deng" onclick="add()">添加</button>
<script type="text/javascript">

    function add() {

        var  name1=$('#username').val();
        var  pwd1=$("#userpwd").val();
        var  num=$('#num').val();
        var  solo=$("#solo").val();

        alert(name1);

        $.ajax({
            type: "POST",
            url: "user/add",
            dataType:'json',
            data:{
                "name": name1,
                "pwd":pwd1,
                "num":num,
                "solo":solo
            },
            success: function (result) {
                alert(result.status)
                if (result.status==0) {
                    window.location.href = 'index.jsp';




                }



            },
            error : function(result) {

                alert("异常！");
            }

        });
    }


</script>
</body>
</html>
